<html>
    <body onLoad="writeYear(),writeYears();">
        <script>
			function check(elem) {
				document.getElementById('catchup').disabled = !elem.selectedIndex;
				document.getElementById('annual').disabled = elem.selectedIndex;
				document.getElementById('annual1').disabled = elem.selectedIndex;
				document.getElementById('workingon').disabled = !elem.selectedIndex;
				document.getElementById('catch_on').disabled = !elem.selectedIndex;

			}
        </script>

		<?php
		if ($this->session->userdata('edit_erro')) {
			echo $this->session->userdata('edit_erro');
			$this->session->unset_userdata('edit_erro');
		}
		if (isset($edit_annual)) {
			?>
			<div id="request-style-boder"> 
				<div id="request-style">
					<div class="request-style">
						<strong class="form-request-heading">EDIT LEAVING REQUEST</strong>
						<hr style="margin-top:10px; height:2px;"/>
						<span><strong class="note">Note:</strong> All <span class="star">*</span> fields are required!</span>
						<?php
						foreach ($edit_annual->result() as $row) {
							echo form_open('manager/update_before_approve');
							?>
							<table>
								<tbody>
									<tr>
										<td class="txt">List Category<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
											<?php
											echo form_hidden('old_desc_id', $this->session->userdata('old_desc_id'));
											echo form_hidden('old_lea_id', $this->session->userdata('old_lea_id'));
											echo form_hidden('record_id', $this->session->userdata('rcd_id'));
											echo form_dropdown('super_type', $leave_type, $row->lea_id, 'id="super" onChange="check(this)" class="span3"') . form_error('super_type', '<span class="req-error">', '</span>');
											?>
										</td>
									</tr>
									<tr>
										<td class="txt">Type of Leave</td>
										<td class="txt1">:</td>
										<td class="input_txt"><?php
									echo form_hidden('old_sub_type', $row->stl_id);
									echo form_dropdown('sub_type', $sub_type, $row->stl_id, 'id="annual" class="span3"');
											?></td>
									</tr>
									<tr >
										<td class="txt">Sub Type of Leave</td>
										<td class="txt1">:</td>
										<td class="input_txt"><?php
									echo form_hidden('old_ss_type', $row->ssl_id);
									echo form_dropdown('ss_type', $ssl_type, $row->ssl_id, 'id="annual1" class="span3"');
									?></td>
									</tr>
									<tr>
										<td class="txt">Description</td>
										<td class="txt1">:</td>
										<!--This is catch up text file -->
										<td class="input_txt"><?php
									echo form_textarea('desc_up', '', 'style="max-height:60px; max-width:255px; min-height:60px; min-width:255px;" id="catchup" disabled="disabled"') . form_error('desc_up', '<span class="req-error">', '</span>');
									?></td>
									</tr>
									<tr>
										<td class="txt">Working On<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
											<?php
											echo form_input('working_on', '', 'id="workingon" class="span3" disabled="disabled"') . form_error('working_on', '<span class="req-error">', '</span>');
											?>
											<input type="hidden" name="working_on" id="working_on_alternate" />
										</td>
									</tr>
									<tr>
										<td class="txt">Catch On<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
		<?php echo form_input('catchup_on', set_value('catchup_on'), 'id="catch_on" class="span3" disabled="disabled"') . form_error('catchup_on', '<span class="req-error">', '</span>'); ?>
											<input type="hidden" name="catch_on_date" id="catchup_on_alternate" />
										</td>
									</tr>
									<!--the end of catch up file-->
									<tr>
										<td class="txt">Time Duration(Hours)<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt"><?php
		echo form_hidden('old_duration', $row->hour);
		echo form_input('duration', $row->hour, 'class="span3"') . form_error('duration', '<span class="req-error">', '</span>');
		?>
										</td>
									</tr>
									<tr>
										<td class="txt">Start Date<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
											<?php
											echo form_hidden('old_s_date', $row->start_date);
											echo form_input('s_date', $row->start_date, 'id="startdate" class="span3"');
											?>
											<input type="hidden" name="s_date" id="start_alternate" />
										</td>
									</tr>
									<tr>
										<td class="txt">End Date<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
		<?php
		echo form_hidden('old_e_date', $row->end_date);
		echo form_input('e_date', $row->end_date, 'id="enddate" class="span3"');
		?>
											<input type="hidden" name="e_date" id="end_alternate" />
										</td>
									</tr>
									<tr>
										<td class="txt">Reasons<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
											<?php
											echo form_hidden('old_reason', $row->lea_reason);
											$data = array('name' => 'txt_reason', 'value' => $row->lea_reason);
											echo form_textarea($data, '', 'style="max-height:100px; max-width:255px; min-height:100px; min-width:255px;"');
											?>
										</td>
									</tr>
									<tr>
										<td colspan="2"></td>
										<td>
		<?php
		$submit = array('name' => 'btn_update', 'value' => 'Update');
		echo anchor('manager/info', form_button('btn_Cancel', 'Cancel', 'class="btn btn-info"'), 'style="text-decoration:none;"') . nbs(2) . form_submit($submit, '', ' class="btn btn-info" ');
		?>
										</td>
									</tr>
								</tbody>
							</table> <?php echo form_close();
	} ?>
					</div>
				</div>
			</div>
<?php } else if (isset($edit_catchup)) { ?>
			<div id="request-style-boder"> 
				<div id="request-style">
					<div class="request-style">
						<strong class="form-request-heading">EDIT LEAVING REQUEST</strong>
						<hr style="margin-top:10px; height:2px;"/>
						<span><strong class="note">Note:</strong> All <span class="star">*</span> fields are required!</span>
	<?php
	foreach ($edit_catchup->result() as $row) {
		echo form_open('manager/update_before_approve');
		?>
							<table>
								<tbody>
									<tr>
										<td class="txt">List Category<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
											<?php
											echo form_hidden('old_desc_id', $this->session->userdata('old_desc_id'));
											echo form_hidden('old_lea_id', $this->session->userdata('old_lea_id'));
											echo form_hidden('record_id', $this->session->userdata('rcd_id'));
											echo form_dropdown('super_type', $leave_type, $row->lea_id, 'id="super" onChange="check(this)" class="span3"') . form_error('super_type', '<span class="req-error">', '</span>');
											?>
										</td>
									</tr>
									<tr>
										<td class="txt">Type of Leave</td>
										<td class="txt1">:</td>
										<td class="input_txt"><?php echo form_dropdown('sub_type', $sub_type, set_value('sub_type'), 'id="annual" class="span3" disabled="disabled"'); ?></td>
									</tr>
									<tr >
										<td class="txt">Sub Type of Leave</td>
										<td class="txt1">:</td>
										<td class="input_txt"><?php echo form_dropdown('ss_type', $ssl_type, set_value('ss_type'), 'id="annual1" class="span3" disabled="disabled"'); ?></td>
									</tr>
									<tr>
										<td class="txt">Description</td>
										<td class="txt1">:</td>
										<!--This is catch up text file -->
										<td class="input_txt"><?php
											echo form_hidden('old_desc_up', $row->description);
											echo form_textarea('desc_up', $row->description, 'style="max-height:60px; max-width:255px; min-height:60px; min-width:255px;" id="catchup"') . form_error('desc_up', '<span class="req-error">', '</span>');
											?>
										</td>
									</tr>
									<tr>
										<td class="txt">Working On<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
		<?php
		echo form_hidden('old_working_on', $row->working_on);
		echo form_input('working_on', $row->working_on, 'id="workingon" class="span3"') . form_error('working_on', '<span class="req-error">', '</span>');
		?>
											<input type="hidden" name="working_on" id="working_on_alternate" />
										</td>
									</tr>
									<tr>
										<td class="txt">Catch On<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
		<?php echo form_input('catchup_on', set_value('catchup_on'), 'id="catch_on" class="span3" disabled="disabled"') . form_error('catchup_on', '<span class="req-error">', '</span>'); ?>
											<input type="hidden" name="catch_on_date" id="catchup_on_alternate" />
										</td>
									</tr>
									<!--the end of catch up file-->
									<tr>
										<td class="txt">Time Duration(Hours)<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt"><?php
		echo form_hidden('old_duration', $row->hour);
		echo form_input('duration', $row->hour, 'class="span3"') . form_error('duration', '<span class="req-error">', '</span>');
		?>
										</td>
									</tr>
									<tr>
										<td class="txt">Start Date<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
		<?php
		echo form_hidden('old_s_date', $row->start_date);
		echo form_input('s_date', $row->start_date, 'id="startdate" class="span3"');
		?>
											<input type="hidden" name="s_date" id="start_alternate" />
										</td>
									</tr>
									<tr>
										<td class="txt">End Date<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
		<?php
		echo form_hidden('old_e_date', $row->end_date);
		echo form_input('e_date', $row->end_date, 'id="enddate" class="span3"');
		?>
											<input type="hidden" name="e_date" id="end_alternate" />
										</td>
									</tr>
									<tr>
										<td class="txt">Reasons<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt">
		<?php
		echo form_hidden('old_reason', $row->lea_reason);
		$data = array('name' => 'txt_reason', 'value' => $row->lea_reason);
		echo form_textarea($data, '', 'style="max-height:100px; max-width:255px; min-height:100px; min-width:255px;"');
		?>
										</td>
									</tr>
									<tr>
										<td colspan="2"></td>
										<td>
							<?php
							$submit = array('name' => 'btn_update', 'value' => 'Update');
							echo anchor('manager/info', form_button('btn_Cancel', 'Cancel', 'class="btn btn-info"'), 'style="text-decoration:none;"') . nbs(2) . form_submit($submit, '', ' class="btn btn-info" ');
							?>
										</td>
									</tr>
								</tbody>
							</table> <?php echo form_close();
						} ?>
					</div>
				</div>
			</div>
<?php } ?>
    </body>
</html>